function dlTabsTabPage()
{
	// the title, now just the filename
	document.title = dlTabsTab.name;
	
	// Various labels on the page
	document.getElementById("filename_desc").setAttribute("value", dlTabsTab.name);
	
	// Progress bar on page
	var list = document.getAnonymousNodes(document.getElementById("progress"));
	for(var i = 0; i < list.length; i++)
	{
		/* Mark the parts of the progress bar on the page
		 * so the CSS doesn't change other progress bars
		 */
		list[i].setAttribute("downloadtabs_progress", "true");
	}
	
	this.refresh = function()
	{
		this.refreshProgress();
		this.refreshLabels();
		this.refreshButtons();
	};
	
	this.progress = document.getElementById("progress");
	this.percentLabel = document.getElementById("progress_percentLabel");
	this.ETALabel = document.getElementById("progress_ETALabel");
	this.sizeLabel = document.getElementById("progress_sizeLabel");
	this.speedLabel = document.getElementById("progress_speedLabel");
	this.rightEnd = document.getElementById("progress_rightEnd");
	
	this.refreshProgress = function()
	{
		//alert("progress");
	
		this.progress.setAttribute("value", dlTabsTab.progress);
		
		if(dlTabsTab.download)
			this.percentLabel.setAttribute("value", dlTabsTab.rounded + "%");
		else
			this.percentLabel.setAttribute("value", "");
		this.ETALabel.setAttribute("value", dlTabsTab.ETA);
		this.sizeLabel.setAttribute("value", dlTabsTab.size);
		this.speedLabel.setAttribute("value", dlTabsTab.speed);
		
		if(!dlTabsTab.download ||
			dlTabsTab.download.state != Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED)
		{
			this.rightEnd.setAttribute("src", "chrome://downloadtabs/skin/progress_rightEnd.png");
		}
		else
		{
			this.rightEnd.setAttribute("src", "chrome://downloadtabs/skin/progress_rightEndFilled.png");
		}
	};
	
	this.fileLabel = document.getElementById("filename");
	this.fileLabelIcon = document.getElementById("filename_icon");
	this.fileLabelDesc = document.getElementById("filename_desc");
	
	this.refreshLabels  = function()
	{
		// Make title label clickable to launch the file
		// Also add an alt text
		if(!dlTabsTab.download ||
			dlTabsTab.download.state != Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED)
		{
			this.fileLabel.removeAttribute("href");
			this.fileLabelIcon.setAttribute("tooltiptext", dlTabsTab.name);
			this.fileLabelDesc.setAttribute("tooltiptext", dlTabsTab.name);
		}
		else
		{
			this.fileLabel.setAttribute("href", "javascript:dlTabsTab.launch();");
			this.fileLabelIcon.setAttribute("tooltiptext", dlTabsTab.strbundle.getString("launchDownload"));
			this.fileLabelDesc.setAttribute("tooltiptext", dlTabsTab.strbundle.getString("launchDownload"));
		}
		
		// Other cropped text must be refreshed too...I think?
		document.getElementById("URL").setAttribute("value", dlTabsTab.URL);
		document.getElementById("path").setAttribute("value", dlTabsTab.folder);
	};
	
	this.pauseImage = document.getElementById("pause");
	this.cancelImage = document.getElementById("cancel");
	this.deleteImage = document.getElementById("delete");
	
	this.remove = new dlTabsLabelButton("remove", function()
		{
			removeDownload(dlTabsTab.download, dlTabsTab.dm);
			dlTabsTab.refresh();
			window.close();
		});
	this.open = new dlTabsLabelButton("open", function()
		{
			openDownloadFolder(dlTabsTab.download);
			dlTabsTab.refresh();
		});
	this.copy = new dlTabsLabelButton("copy", function()
		{
			copyDownload(dlTabsTab.download);
			dlTabsTab.refresh();
		});
	
	// Refresh the image buttons
	this.refreshButtons = function()
	{
		if(dlTabsTab.download)
			setImages(dlTabsTab.download.state, this.pauseImage, this.pauseState,
										this.cancelImage, this.cancelState, dlTabsTab.strbundle);
		else
			disableImages(this.pauseImage, this.pauseState,
										this.cancelImage, this.cancelState, dlTabsTab.strbundle);
		
		// Image buttons
		if(!dlTabsTab.download)
			this.deleteImage.setAttribute("src", "chrome://downloadtabs/skin/delete_disabled.png");
		else if(this.deleteState)
			this.deleteImage.setAttribute("src", "chrome://downloadtabs/skin/delete_on.png");
		else
			this.deleteImage.setAttribute("src", "chrome://downloadtabs/skin/delete_off.png");
			
		this.remove.refresh();
		this.open.refresh();
		this.copy.refresh();
	};
	
	// ====================================== Image Buttons ======================================
	// (Used to collapse the text)
	{			
		// Pause/Resume the download
		this.pause = function()
		{
			if(dlTabsTab.download)
			{
				pauseDownload(dlTabsTab.download, dlTabsTab.dm);
				dlTabsTab.refresh();
			}
		}
		
		this.pauseMouseDown = function()
		{
			this.pauseState = true;
			dlTabsTab.refresh();
		}
		
		this.pauseMouseUp = function()
		{
			if(this.pauseState)
			{
				this.pauseState = false;
				this.pause();
			}
		}
		
		this.pauseMouseExit = function()
		{
			if(this.pauseState)
			{
				this.pauseState = false;
				dlTabsTab.refresh();
			}
		}
		
		// Cancel/Retry the download
		this.cancel = function()
		{
			if(dlTabsTab.download)
			{
				cancelDownload(dlTabsTab.download, dlTabsTab.dm);
				dlTabsTab.refresh();
			}
		}
		
		this.cancelMouseDown = function()
		{
			this.cancelState = true;
			dlTabsTab.refresh();
		}
		
		this.cancelMouseUp = function()
		{
			if(this.cancelState)
			{
				this.cancelState = false; 
				this.cancel();
			}
		}
		
		this.cancelMouseExit = function()
		{
			if(this.cancelState)
			{
				this.cancelState = false;
				dlTabsTab.refresh();
			}
		}
		
		// Delete the file
		this.deleteDownload = function()
		{
			if(dlTabsTab.download)
			{
				deleteDownload(dlTabsTab.download, dlTabsTab.dm);
				dlTabsTab.refresh();
				window.close();
			}
		}
		
		this.deleteMouseDown = function()
		{
			this.deleteState = true;
			dlTabsTab.refresh();
		}
		
		this.deleteMouseUp = function()
		{
			if(this.deleteState)
			{
				this.deleteState = false; 
				this.deleteDownload();
			}
		}
		
		this.deleteMouseExit = function()
		{
			if(this.deleteState)
			{
				this.deleteState = false;
				dlTabsTab.refresh();
			}
		}
	}
}